package net.maxwoods.springcloud;/**
 * @description:
 * @authoer: Max Woods
 * @create:2018/7/9 11:35
 **/

import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.gateway.mvc.ProxyExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;

import java.util.function.Function;

/**
 *@auther: Max Woods
 *@create:2018/7/9 11:35
 **/
@SpringBootConfiguration
@EnableAutoConfiguration
@Controller
public class Gateway {

    @GetMapping("/test")
    public ResponseEntity<?> proxy(ProxyExchange<byte[]> proxy) throws Exception {
        return proxy.uri("http://www.maxwoods.net").get();
    }

    public static void main(String[] args) {
        SpringApplication.run(Gateway.class, args);
    }
}
